/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.springtree.spectrum.visa.persistence.dao;

import co.springtree.spectrum.visa.persistence.constant.EDatabase;
import co.springtree.spectrum.visa.persistence.factory.ConnectionDataSourcePoolMySQL;
import co.springtree.spectrum.visa.persistence.factory.DAOFactory;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.util.Collection;

/**
 * Clase abstract para la definición de los DAO´s
 *
 * @author Ricardo Carvajal Salamanca
 *
 */
public abstract class AbstractDAO<T> {

    protected Connection connection = null;
    protected PreparedStatement statement;
    protected ResultSet rs;
    protected String sQLQuery;

    public AbstractDAO() {
    }

    protected ConnectionDataSourcePoolMySQL getConnectionPool() {
        ConnectionDataSourcePoolMySQL connectionPool = DAOFactory.getInstance().getConnectionPool(EDatabase.MYSQL);
        return connectionPool;
    }

    public abstract void insert(T object) throws SQLException;

    public abstract void update(T object) throws SQLException;

    public abstract void delete(T object) throws SQLException;

    public abstract T select(T object) throws SQLException;

    public abstract Collection<T> selectAll() throws SQLException;

    public abstract void createTable(boolean dropTable) throws Exception;
}
